import Vue from 'vue'
import App from './App.vue'
// 定义全局组件
import TypeNav from '@/components/TypeNav'
import Carousel from "@/components/Carousel";
import Pagination from "@/components/Pagination";
import Toolbar from '@/components/Toolbar'

// 引入路由组件
import router from '@/router'
// 引入mockServer
import '@/mock/mockServe';
// 引入swiper样式
import 'swiper/css/swiper.css'
// elementui
import {
  Button,
  MessageBox,
  Message,
  Alert,
} from 'element-ui';

Vue.config.productionTip = false


Vue.component(TypeNav.name, TypeNav);
Vue.component(Carousel.name, Carousel);
Vue.component(Pagination.name, Pagination);
Vue.component(Toolbar.name, Toolbar);

Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$message = Message;
Vue.prototype.$alert = MessageBox.alert;

Vue.component(Button.name, Button, Alert);

// 引入仓库
import store from '@/store'
// 统一引入接口：接口文件中的全部请求函数
import * as API from '@/api'
new Vue({
  render: h => h(App),
  beforeCreate() {
    Vue.prototype.$bus = this;
    Vue.prototype.$API = API;
  },
  // 注册路由
  router,
  store,
}).$mount('#app')
